package com.lagou.mapper;

import com.lagou.domain.Role;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author wsl
 * @Date 2021/11/4 22:36
 * @Project_Name mybatis_quickstart
 */
public interface RoleMapper {

    /**
     * 1.用于多对多查询：根据用户传递过来的用户id,查询该用户所属的角色列表
     * @param uid
     * @return
     */
    @Select("SELECT * FROM sys_role r INNER JOIN sys_user_role ur ON ur.roleid = r.id WHERE ur.userid = #{uid}")
    public List<Role> findRoleByUid(Integer uid);
}
